#include "robotpose.h"

#include <cfloat>

bool RobotPose::hasJointAngle(int channel) const {
    return jointMap.contains(channel);
}

float RobotPose::jointAngle(int channel) const {
    if (hasJointAngle(channel)) {
        return jointMap.find(channel).value();
    } else {
        return FLT_MAX;
    }
}

void RobotPose::setJointAngle(int channel, float theta) {
    jointMap.insert(channel, theta);
}

QVector<int> RobotPose::joints() const {
    QVector<int> ret;
    foreach (int joint, jointMap.keys()) {
        ret.append(joint);
    }
    return ret;
}
